<?php
/**
 * Created by PhpStorm.
 * User: sunshubo
 * Date: 2017/11/16
 * Time: 22:30
 */

class GetTenant_model extends MY_Model
{
    function get_info()
    {
        $sql = /** @lang text */
            "SELECT name,city FROM ws_dict_tenant";
        $query = $this->db->query($sql);
        $error = $this->db->error();
        if ($query) {
            $count = $query->num_rows();
            $name = array('请选择');
            foreach ($query->result_array() as $key => $value) {
//                    array_push($data['data'], $value);
                array_push($name, $value['name'] . '+' . $value['city']);
            }
            return json_encode(array('result' => SUCCESS, 'data' => $name, 'count' => $count));
        }
        return json_encode(array('result' => ERROR, 'code' => $error['code']));
    }
}